package com.niit.session13;

public class Girlfriend {
	private String name;
	private int age;

	public Girlfriend(String name, int age) {
		super();
		this.name = name;
		if(age<18 || age >50) {
//			throw用于手动抛出异常
			throw new AgeException("年龄不合法，很刑，非常可拷！");
		}
		this.age = age;
	}

	public Girlfriend() {
		super();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age)  {
		if(age<18 || age >50) {
//			throw用于手动抛出异常
			throw new RuntimeException("年龄不合法，很刑，非常可拷！");
		}
		this.age = age;
	}

}
